<template>
    <div>
        <a-table style="margin-top:16px" class="bigstyle" rowKey="id" :columns='columns' :loading="loading"
            :dataSource='dataList' :locale="defaultSetting" :pagination='pagination' size='small'>
        </a-table>
    </div>
</template>

<script>
import EmptyData from '@/components/common/EmptyData'

export default {
    name: 'tableAD',
    components: { EmptyData },
    data() {
        return {
            loading: false,
            dataList: [
                { name: '1', rule_status: '0'}
            ],
            defaultSetting: { emptyText: <EmptyData /> },
            pagination: {
                defaultPageSize: 10,
                showTotal: total => `${this.$t('A-total-of')} ${total} ${this.$t('Data')}`,
                showSizeChanger: true,
                pageSizeOptions: ['5', '15', '20', '25'],
                onShowSizeChange: (current, pageSize) => this.pageSize = pageSize,
                buildOptionText: (props) => `${props.value} / ${this.$t('page')}`
            },
            columns: [
                { title: this.$t('AD用户名'), dataIndex: 'user_name', key: 'user_name' },
                { title: this.$t('AD用户组'), dataIndex: 'department', key: 'department' },
                { title: this.$t('创建时间'), dataIndex: 'create_time', key: 'create_time' },
            ],
        }
    },
    mounted() {
        const id = this.$route.query.id
        this.getList(id)
    },
    methods: {
        async getList(id) {
            const { data } = await this.$api.authentication.getUser({ id })
            this.dataList = data.user
        },
    }
}
</script>